<?php

class Admin_process extends CI_Model {//这里关于admin表的一些操作和登录判定

    const Statustrue = True;
    const Statusflase = False;

    function __construct() {
        parent::__construct();
    }

    function logout_action() {
        
    }

    function login_action() {

        $email = $this->input->post('email');
        $pwd = $this->input->post('pwd');
        //独立开启xss过滤和防止注入
        
        $pwd = md5($pwd);
    
         $sql = "select * from admin where email=\"{$email}\" and pwd=\"{$pwd}\"";     
   
      
        $query = $this->db->query($sql);
        $res = $query->result_array();
        if (!empty($res)) {
            return Admin_process::Statustrue;
        } else {
            return Admin_process::Statusflase;
        }
    }

}

?>
